<script setup>
import { Picture as IconPicture } from '@element-plus/icons-vue'
import { ElMessage } from "element-plus";
import {ref,onMounted} from 'vue'
import {oneToOneLink,getUrlLink} from '@/api/api'
const linkData = ref([])
function navigate(item){
  if (item.jumpUrl == '') {
    ElMessage.warning("暂无跳转链接!");
    return
  }
  window.open(item.jumpUrl,'_blank')
}
// 获取下载链接
async function getLink(){
  try {
    const data = await getUrlLink()
    if(data.status === 0){
      linkData.value = JSON.parse(data.result)
    }
  } catch (e) {
  
  }
}
onMounted(()=>{
  getLink()
})
</script>

<template>
  <div class="workshop">
    <!-- <div class="top">
      <div class="item">
        <img />
        <div class="intro"></div>
      </div>
      <div class="item">
        <img />
        <div class="intro"></div>
      </div>
    </div> -->
    <div class="bottom">
      <div v-for="(item,index) in linkData" :key="index" class="item" @click="navigate(item)">
        <el-image :src="item.imgUrl">
          <template #error>
            <div class="image-slot">
              <el-icon><icon-picture /></el-icon>
            </div>
          </template>
        </el-image>
      </div>
      <!-- <div class="item" @click="navigate('linkUrlOne')">
        <div class="title">24/25考研一对一择校择专业</div>
        <div class="tags">
          <div class="ele">择校择专</div>
          <div class="ele">1v1指导</div>
         <div class="ele">赠英语班</div>
        </div>
        <div class="recommend">
          <div class="text">推荐</div>
        </div>
        <div class="tip">24/25择校</div>
      </div>
      <div class="item" @click="navigate('linkUrlTwo')">
        <div class="title">24/25考研一对一直系学长学姐辅导</div>
        <div class="recommend">
          <div class="text">推荐</div>
        </div>
        <div class="tip">一对一</div>
        <div class="tags">
          <div class="ele">高分学长学姐</div>
          <div class="ele">1v1指导</div>
         <div class="ele">赠英语班</div>
        </div>
      </div> -->
    </div>
  </div>
</template>

<style scoped lang="less">
.image-slot {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  background: var(--el-fill-color-light);
  color: var(--el-text-color-secondary);
  font-size: 30px;
}
.image-slot .el-icon {
  font-size: 30px;
}
.workshop{
  box-sizing: border-box;
  padding: 16px calc((100% - 1200px)/2) 0;
	min-width: 1200px;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  .top{
    display: flex;
    align-items: center;
    justify-content: space-between;
    .item{
      flex: 1;
    }
  }
  .bottom{
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    .item {
      box-sizing: border-box;
      position: relative;
      // padding: 24px;
      margin-top: 24px;
      // box-shadow: rgb(230, 230, 230) 0px 0px 15px;
      height: 300px;
      width: 48%;
      border-radius: 24px;
      background-color: #fff;
      overflow: hidden;
			cursor: pointer;
      .recommend {
        position: absolute;
        left: 0;
        top: 0;
        border: 32px solid transparent;
        border-left: 32px solid #000;
        border-top: 32px solid #000;
        .text{
          position: absolute;
          top: -18px;
          left: -26px;
          width: max-content;
          background-color: #000;
          color: #fff;
          transform: rotate(315deg);
        }
      }
      .tip{
        padding-left: 12px;
        padding-right: 12px;
        position: absolute;
        right: 0;
        top: 16px;
        line-height: 32px;
        background-color: #f3d973;
        font-size: 14px;
        font-weight: 300;
        width: max-content;
        border-radius: 24px 0 0 24px;
      }
      .title{
        padding-top: 32px;
        font-size: 24px;
        font-weight: 300;
      }
      .tags{
        margin-top: 16px;
        display: flex;
        align-items: center;
        .ele{
          margin-right: 10px;
          padding: 8px 24px;
          background-color: #414141;
          color: #dac464;
          border-radius: 18px 0 18px 0;
        }
      }
    }
  }
}
</style>
